product_list = [
    ('华为P30',3800),
    ('iPhone 12',9800),
    ('奶茶',15),
    ('Crabs',88),
    ('单车',800),
    ('手表',100050),
    ('Nike bag',128),
    ('书籍',100)
    ]
shopping_car = []
zhifubao = input("请你输入你的支付宝数字余额：")
if zhifubao.isdigit():
    zhifubao = int(zhifubao)
    while True:
        for item in product_list:
            print(product_list.index(item),item)
        choice = input("请输入商品编号：")
        if choice.isdigit():
            choice = int(choice)
            if choice >=0 and choice <=7:
                if zhifubao >=product_list[choice][1]:
                    zhifubao = zhifubao - product_list[choice][1]
                    shopping_car.append(product_list[choice])
                    print("你已经将商品%s添加到了购物车，你的支付宝余额是%s"% (product_list[choice][0],zhifubao))
                else:
                    print("你的支付宝余额不足，请选择其他商品")
            else:
                print("你选择的商品不在商品列表中")
        elif choice == "quit":
            print("------购物车清单------")
            for item in shopping_car:
                print(item)
            print("你的支付宝余额是：%s"% zhifubao)
            break
        else:
            print("请你输入商品编号")
else:
    print("请你输入数字的支付宝余额")